import com.alibaba.fastjson.JSONObject;

import java.io.UnsupportedEncodingException;

public class GmSignTestUtil {
    public static void ujApplyDb() throws UnsupportedEncodingException {
        String reqParams = "{\n" +
                "    \"respData\": \"f6YC5a36iyIJSswpdYnvsEXXkyMIvh1MFp5/d7lJBbYVJxTjvelGmK4m7OjhKe8oxpwt1ybVOvHDGgRsyzKn9itWhmZ+kFNNZb5JkqUsIKK49DhsusFiDAe3+KXb1tRRM6typHmttvrIbkYKsyQ5MVsjOKe93DS+Bg8ZSRQu0JcyISpHd1u2oSXShH67V/qs\",\n" +
                "    \"reqHead\": {\n" +
                "        \"signData\": \"JBbfknsnikZm5q/4G30I9kOK5JzgqQDjIvtQ+W16AFWKh4f0HGdvqXC0exZRAG0QQG9AvpARV5pYaxUu4M+e7gzUdi/24H9k+Znf8BAispKGbk1oDtHAcWsZTlipxMjgtzsTSEfdcrXP/za/tgMMsIIH0MTufqVh3sEEB06Q0cs=\",\n" +
                "        \"randomKey\": \"PCUGockfkDAHUaoDEtA2sb0RAk3tG4GfL9i29d56TpoPDmkMfHBSvISbj6qkwgkEz3RYghsI9rgQmFfwybiNJsBpjJg0M2IGk2NpQQvxY8fJqr0Ds8be4ThLRG3qn8NWYHgJKuye/PtIf0/Hw9ZXcH+btDGGF7vKkRTvsjQHfM8=\"\n" +
                "    }\n" +
                "}";
        UnionJointGuoMeiApiResponse request = JSONObject.parseObject(reqParams, UnionJointGuoMeiApiResponse.class);
        String sign = request.getReqHead().get("signData");
        String randomKey = request.getReqHead().get("randomKey");
        String key = GmSignUtil.decryptByPrivateKey4Pkcs5(randomKey.getBytes(),"MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAL0bI+h4COP1Rul7S1+2fl9PuVHINPfIHO+mRK+M3wOrd1nRJFxj7VEoiNc3VGjNa8yIOovtRpTQQbO1Edm5aqGhTyboVXnVeDoe22rTBxf6KfCBRR0NqjAa1DbtfUlrggLXZKkffZ3ujJlZX5YDUwiw8n5CzJtXT6xwmrG1o/lXAgMBAAECgYBrXyydQwJxRIQV776VQs4wGdk0WUPR6Jqda7+WGZtKvyHOKpTFrKtDqItB/5V6yCBMCpGLf5bSygh0G/xdrgyfbNmv44psYRQPgeFdQSFfO7OfhXy791p3UcqhdwyqcEg17u2Dhojg1E3pRTS4txbI2+2h/70Hcq6nLuyyn0Dq2QJBAOo8FQo5h6xaKHk+oSpOyjUajGU1FDwrAJCL6tccPbcEgBCFuJ2aypE/hQf3khtLUTArfA57don+AwfzAh0DTVUCQQDOrYxNxzBSbw84A1ef9vRf5vboWKV7YX0EdYeF8jCis6qPpQClkzfh3heiGSPkLlNyZTwpxSzd9BCGQlZmwov7AkEA6Zk35nWPb/yOJrSmKDphgOpUH876ujKsontXnmXkynQrf87MWil4Ybi2ZEarqJrJgj+rvgm1I1N3FGNutR6I7QJBAIPdasU9L3GI9nbQexnO4MBHhoVb+cksvC0aJ6uoiKtmYo5fwnfh5CeyIfYEgEfX3toACVDFQwkh7WEb9jB+M/0CQFDycO42JHxFZao0DOdsXByXNd2YRMb/cdTdi4CiUA7Jb+bk/lk40ltty9vZPNugtRkhXB+ocHGsnBRu8BIYkuI=");
        String decryptRspStr = GmSignUtil.decrypt4Base64(request.getRespData(), key);
//        boolean signStatus = jointLoginAndHittingDbService.verifyGuoMeiSignStatus(decryptRspStr, sign);
//        System.out.println("撞库验签结果：signStatus=" + signStatus);
        System.out.println("-------------------------------");
        System.out.println("准入接口返回结果: "+decryptRspStr);
    }

    public static void main(String[] args) throws UnsupportedEncodingException {
        ujApplyDb();

    }
}


